import React, { useMemo } from 'react';
import { Modal, Button, DataSet } from 'choerodon-ui/pro';
import ModalDetail from './ModalDetail';
import modalDataSet from './modalDataSet';

const modalKey = Modal.key();

const ModalBasic: React.FC = () => {
  const modalDs = useMemo(() => new DataSet(modalDataSet()), []);

  const openModal = () => {
    Modal.open({
      key: modalKey,
      title: 'Basic',
      children: <ModalDetail ds={modalDs} />,
      okText: '确定',
      okProps: {
        disabled: true,
      },
    });
  };

  return (
    <Button onClick={openModal}>
      Open
    </Button>
  );
};

export default ModalBasic;